package com.example.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.example.model.Department;

@Mapper
public interface DepartmentMapper {

	@Options(useGeneratedKeys = true, keyProperty = "id")
	@Insert("insert into department(departmentName) values(#{departmentName})")
	int saveDepartment(Department department);

	@Delete("delete form department where id = #{id}")
	int deleteDepartmentById(Integer id);

	@Update("update department set departmentName = #{departmentName} where id = #{id}")
	int updatDepartmentById(Department department);

	@Select("select * from department where id = #{id}")
	Department selectDepartmentById(Integer id);

}
